package com.xuanyuanxinyu.core.arouter

import android.net.Uri
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.xuanyuanxinyu.core.R

@Route(path = IArouterConstants.PATH_AROUTER_ACTIVITY)
class ArouterActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_arouter)

        val param = intent.getStringExtra("param")
        param?.let {
            findViewById<TextView>(R.id.tvContent).text = param
        }

    }
    
    

    override fun onBackPressed() {
        super.onBackPressed()
        //        super.onBackPressed()

        val uri = Uri.parse("https://www.aliyun.com/")
//            Uri uri = Uri.parse("https://www.baidu.com/");
        val postcard = ARouter.getInstance()
                    .build(uri);
        postcard.navigation()
//        val uri = intent.data
//        ARouter.getInstance().build(uri).navigation()
//        finish()

//        val intent = Intent()
//        intent.putExtra("result", "返回数据")
//        setResult(RESULT_OK, intent)
//        finish()
    }
}